<?php
if ( !defined( "IN_OP" ) )
{
    exit( "You can't access this file directly..." );
}
if ( ( $curruser['acl'] < 255 || $curruser['acl'] == 255 && $curruser['prev_id'] != 0 ) && !SubAccountRight( $curruser, 1 ) )
{
    diemsg( "你不是管理者！" );
}
$ui = new UI();
$tpl = new Template2();
$conf = new Config();
$rs = getdb( "select id,round,open from lotto where open>='".date( "Y-m-d" )."' order by open" );
if ( $rs->eof )
{
    $ui->showErrorPage( "<p>目前没有期数！</p>", true );
    exit();
}
$lotto_id = $rs->f['id'];
$round = $rs->f['round'];
$open = $rs->f['open'];
$rs->close();
$tpl->set( "lotto_id", $lotto_id );
$tpl->set( "round", d3( $round ) );
$tpl->set( "open", $open );
$waitbet = $conf->get( "waitbet" );
$stopbet = $conf->get( "stopbet" );
$t1 = strtotime( $open." ".$stopbet );
$t2 = strtotime( $open." ".$waitbet );
$tpl->Set( "timestap", $t1 - systime( ) );
$tpl->set( "phptime", systime( ) );
$g_risk_value = isset( $g_risk_value ) ? $g_risk_value : 500000;
$g_risk_value = 0 - $g_risk_value;
$bo1 = isset( $_COOKIE['bo1'] ) ? $_COOKIE['bo1'] : 42;
$bo2 = isset( $_COOKIE['bo2'] ) ? $_COOKIE['bo2'] : $g_risk_value;
$tpl->set( "bo1", $bo1 );
$tpl->set( "bo2", $bo2 );
if ( $conf->get( "stopbet" ) <= date( "Hi" ) )
{
    $tpl->set( "stopnowdisable0", "disabled" );
    $tpl->set( "startnowdisable", "disabled" );
}
if ( $conf->get( "protect_start" ) == 1 )
{
    $tpl->set( "startnowdisable", "disabled" );
}
$chkhint = isset( $_COOKIE['chkhint'] ) ? $_COOKIE['chkhint'] : false;
if ( $chkhint )
{
    $tpl->set( "chint0", "checked" );
}
$chksound = isset( $_COOKIE['chksound'] ) ? $_COOKIE['chksound'] : false;
if ( $chksound )
{
    $tpl->set( "chint1", "checked" );
}
include_once( "class_6h/class.menu.php" );
$fieldArr = array( "round" => $round, "open" => $open, "lotto_id" => $lotto_id, "split_id" => 1 );
$onlineMenu = new menu_6h( 1, $fieldArr );
$selectid = getvar( "select" ) == "" ? 0 : getvar( "select" );
$menuList = $onlineMenu->getMenu( $selectid );
$tpl->set( "menuList", $menuList );
unset( $onlineMenu );
$tpl->load( "main", "now1.htm" );
$tpl->set( "jslang", $g_conf['language'] );
$tpl->show( "main" );
sess_gc();
$ui->footer();
?>